<template>
  <!-- 预约列表 -->
  <div class="content-box">
    <table class="table-box">
      <thead>
        <tr>
          <th>预约类型</th>
          <!-- <th>预约诊所</th> -->
          <th>预约时间</th>
          <th>预约科室</th>
          <th>预约医生</th>
          <th style="width:400px;">预约内容</th>
          <th>操作</th>
        </tr>
      </thead>
      <tbody>
        <tr v-for="(item,index) in tabList" :key="index">
          <td>{{item.registerName}}</td>
          <!-- <td>{{item.uidNickName}}</td> -->
          <td>{{item.dateDay}}</td>
          <td>{{item.deptName}}</td>
          <td>{{item.doctorName}}</td>
          <td style="width:400px;">{{item.registerContent}}</td>
          <td>
            <el-link v-if="item.status!=4" @click="edit(item)">编辑</el-link>
          </td>
        </tr>
      </tbody>
    </table>
    <div v-if="tabList.length == 0" style="color:#999;padding:10px 0;text-align:center;">
      <i class="iconfont iconwushuju" style="font-size:40px;"></i>
      <div>暂无数据</div>
    </div>
    <br />
    <pager v-model="pager" @change-pagenum="findJaBalancelogAll"></pager>
    <edit v-if="editRegister" v-model="editRegister" :curItem="curItem" @success="findJaBalancelogAll"></edit>
  </div>
</template>
<script>
export default {
  name: "visitRecord",
  data() {
    return {
      tabList: [],
      pager: { pageSize: 20, pageNum: 1, total: 0 },
      form: { patientId: "", hpId: "" },
      editRegister: false,
      curItem: ""
    };
  },
  mounted() {
    let th = this;
    th.findJaBalancelogAll();
  },
  methods: {
    findJaBalancelogAll(type) {
      let th = this;
      if (type == -1) {
        th.pager.pageNum = 1;
        th.pager.total = 0;
      }
      th.form.patientId = th.jieMi(th.$route.query.id);
      th.form.hpId = th.adminUser.hpId;
      let json = Object.assign(th.pager, th.form);
      th.$api.getRegisterListInfo(json).then(res => {
        if (res.executed) {
          th.tabList = res.dataBody.list;
          th.pager.total = res.dataBody.total;
        } else {
          th.$message.error(res.message);
          th.tableList = [];
          th.pager.total = 0;
        }
      });
    },
    edit(obj) {
      let th = this;
      th.editRegister = true;
      th.curItem = obj;
    }
  },
  components: {
    edit: () => import("../_com/editRegister")
  }
};
</script>
<style lang="scss" scoped>
@import "../_css/detail.scss";
</style>

